win32: Fix return value of get_device_state
authorMatthias Clasen <mclasen@redhat.com>
Wed, 26 Aug 2020 20:35:28 +0000 (16:35 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 26 Aug 2020 21:56:41 +0000 (17:56 -0400)
We need to look a the position, not the child surface.

gdk/win32/gdksurface-win32.c

index 4708ea793528fda6189f3750369ca06d927ed342..33a279f8e1edf32f115773e0e79f89a24311a10e 100644 (file)
@@ -1724,19 +1724,16 @@ gdk_win32_surface_get_root_coords (GdkSurface *window,
 }
 
 static gboolean
-gdk_surface_win32_get_device_state (GdkSurface       *window,
-                                   GdkDevice       *device,
-                                   double          *x,
-                                   double          *y,
-                                   GdkModifierType *mask)
+gdk_surface_win32_get_device_state (GdkSurface     *window,
+                                    GdkDevice       *device,
+                                    double          *x,
+                                    double          *y,
+                                    GdkModifierType *mask)
 {
-  GdkSurface *child;
+  _gdk_device_win32_query_state (device, window, NULL, x, y, mask);
 
-  g_return_val_if_fail (window == NULL || GDK_IS_SURFACE (window), FALSE);
+  return *x >= 0 && *y >= 0 && *x < window->width && *y < window->height;
 
-  _gdk_device_win32_query_state (device, window, &child, x, y, mask);
-
-  return (child != NULL);
 }
 
 static void